package com.atguigu.lease.common.exception;

import com.atguigu.lease.common.exception.define.BusException;
import com.atguigu.lease.common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalException {
    @ExceptionHandler(value = BusException.class)
    public Result busException(BusException e){
        return Result.fail(null,e.getCode(), e.getMessage());
    }
}
